home *** CD-ROM | disk | FTP | other *** search
/ Complete Linux / Complete Linux.iso / docs / apps / database / postgres / postgre3.z / postgre3 / src / lib / H / utils / context.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-08-27  |  2.0 KB  |  74 lines

  1. /*
  2.  * context.h --
  3.  *    Declarations for memory contexts.
  4.  *
  5.  * Identification:
  6.  *    "$Header: /private/postgres/src/lib/H/utils/RCS/context.h,v 1.3 1990/08/17 08:54:06 cimarron Exp $"
  7.  */
  8.  
  9. #ifndef ContextIncluded
  10. #define ContextIncluded
  11.  
  12. #include "tmp/postgres.h"
  13. #include "tmp/simplelists.h"
  14.  
  15. #define    MMGRSIZE    (1 << 16)
  16.  
  17. struct mchain {
  18.     struct mchain    *mc_next;
  19.     struct mchain    *mc_prev;
  20.     char        *mc_name;    /* for tracing  */
  21.     int        mc_len;        /* must be last */
  22. /*     int        mc_data[];    /* VARIABLE-LENGTH ARRAY */
  23. };
  24.  
  25. struct memhead {
  26.     short        mh_flags;
  27.     short        mh_stacked;
  28.     struct memhead    *mh_prev;    /* previous memory block */
  29.     int        *mh_topfast;    /* end of memory block   */
  30.     int        *mh_botfast;    /* beginning of memory block */
  31.     struct mchain    mh_slow;    /* doubly-linked-list of slow memory */
  32. };
  33.  
  34. struct context {
  35.     SimpleNode    ct_node;    /* doubly linked list of context strs    */
  36.     int        ct_status;
  37.     struct memhead    *ct_mh;        /* current memory block */
  38.     struct context    *ct_prev;
  39.     struct context    *ct_head;
  40.     int        *ct_lmtfast;    /* end of ct_mmgr           */
  41.     long        ct_allocated;    /* ttl bytes allocated in this ctx*/
  42.     long        ct_fallocated;    /* just the fast memory          */
  43.     char        *ct_name;    /* name of context          */
  44.     int        ct_mmgr[MMGRSIZE];
  45. };
  46.  
  47. #define    CT_VOLATILE    00    /* user space: ok to kill */
  48. #define    CT_PRESERVE    01    /* permanent system space: don't kill */
  49. #define    CT_BOOTSTRAP    02    /* for standalone programs */
  50.  
  51. /* XXX OBSOLETE */
  52. struct xaction {
  53.     OID        xa_user;
  54.     struct    context    xa_topcxt;
  55. };
  56.  
  57. extern struct xaction    Xact;
  58. extern struct context    *TopContext;
  59. extern struct context    *Curcxt;
  60. extern struct memhead    *Curmem;
  61. extern SimpleList    ContextList;
  62.  
  63. #define    ENABLE_BOOTSTRAP()    TopContext->ct_status |= CT_BOOTSTRAP
  64. #define    DISABLE_BOOTSTRAP()    TopContext->ct_status &= ~CT_BOOTSTRAP
  65.  
  66. extern            initXact();
  67. extern struct context     *topcontext();
  68. extern struct context     *switchcontext();
  69. extern struct context     *newcontext();
  70. extern struct context     *newnamedcontext();
  71. extern struct context     *killcontext();
  72.  
  73. #endif    /* !ContextIncluded */
  74.